<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>产品简介</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	
  </head>
  
  <body>
    
 <input type="button" value="新增产品" onclick='addProduct()' />
<div>&nbsp;</div>


<table width="524" border="1" cellspacing="0" cellpadding="0">
  <tr bgcolor="#999999">
    <th width="175" height="45" scope="col">产品名称</th>
    <th width="176" scope="col">创建时间</th>
    <th width="165" scope="col">操作</th>
  </tr>
  
  <c:forEach varStatus="status" items="${myPage.list}" var="item">
  
  <tr align="center">
    <td height="43">${item.title}</td>
    <td>${item.time}</td>
    <td> 
          <a href="editProduct.do?id=${item.id}">编辑</a>
        | <a href="#" onclick="delProduct(${item.id})">删除</a>
    </td>
  </tr>
  
  </c:forEach>
  
  
  <tr align="center">
    <td height="45" colspan="3">
                 共有${myPage.rowCount}条记录
      
      <c:choose>
         <c:when test="${myPage.page==1}">
             &nbsp;首页
             &nbsp;上一页
         </c:when>
         <c:otherwise>
             &nbsp;<a href="productInt.do?page=1">首页</a>
             &nbsp;<a href="productInt.do?page=${myPage.page-1}">上一页</a>
         </c:otherwise>
      </c:choose>
      
      <c:choose>
         <c:when test="${myPage.page==myPage.pageCount}">
               &nbsp;下一页
               &nbsp;尾页 
         </c:when>
         <c:otherwise>
              &nbsp;<a href="productInt.do?page=${myPage.page+1}">下一页</a>
              &nbsp;<a href="productInt.do?page=${myPage.pageCount}">尾页</a>  
         </c:otherwise>
      </c:choose>
      
    </td>
  </tr>
</table>
    
    
 <script type="text/javascript">

 function addProduct(){
	
	location.href="addProduct.do"; 
	 
 } 
  
  
 function delProduct(id){
	 
	 if(confirm("确定删除？")){
		 
		location.href="deleteProduct.do?id="+id; 
	 }
	 
	 return false;
 }
</script>   


 </body>
</html>
